using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using UWBGL_WinForms_Lib1;
using UWBGL_XNA_Lib13;

namespace XNA_SceneNode
{
    public class CArm : UWB_SceneNode
    {
        public CArm(Vector3 at, string name) : base(name)
        {
            UWB_PrimitiveList pList = new UWB_PrimitiveList();
            Vector3 c1 = new Vector3(at.X, at.Y - 1.0f, 0.0f);
            Vector3 c2 = new Vector3(at.X + 3.0f, at.Y + 1.0f, 0.0f);

            UWB_PrimitiveRectangle rec = new UWB_PrimitiveRectangle();
            rec.setCorners(c1, c2);
            rec.setFlatColor(new Color(150, 0, 0, 100));
            rec.setShadeMode(eShadeMode.smFlat);
            pList.append(rec);

            rec = new UWB_PrimitiveRectangle();
            rec.setCorners(new Vector3(at.X, at.Y - 1.0f, 0.0f), new Vector3(at.X + 0.5f, at.Y + 1.0f, 0.0f));
            rec.setFlatColor(new Color(200, 200, 0));
            rec.setShadeMode(eShadeMode.smFlat);
            pList.append(rec);

            rec = new UWB_PrimitiveRectangle();
            rec.setCorners(new Vector3(at.X + 2.5f, at.Y - 1.0f, 0.0f), new Vector3(at.X + 3.0f, at.Y + 1.0f, 0.0f));
            rec.setFlatColor(new Color(200, 200, 0));
            rec.setShadeMode(eShadeMode.smFlat);
            pList.append(rec);

            setPrimitive(pList);
            mXFormInfo.setPivot(at);

            Vector3 pat = new Vector3(at.X + 4.0f, at.Y, 0.0f);
            UWB_SceneNode palm = new CPalm(pat);
            insertChildNode(palm);
        }

        public UWB_XFormInfo GetPalmXform()
        {
            return mChildNodes.m_Array[0].getXFormInfo();
        }
        public void SetPalmXform(UWB_XFormInfo xf)
        {
            mChildNodes.m_Array[0].setXFormInfo(xf);
        }
        public UWB_SceneNode GetPalmNode()
        {
            return mChildNodes.m_Array[0];
        }
    }
}

